<template>
    <md-card>
      <md-card-header :data-background-color="dataBackgroundColor">
        <h5 class="title">基本信息</h5>
      </md-card-header>

      <md-card-content>
        <div class="md-layout">

          <edit-item title="金融产品*" edittype="S">
            <select v-model="formdata.finProductId">
              <option v-for="option in productlist" v-bind:value="option.CARPRODUCTID" :key="option.itemvalue">
                {{ option.CARPRODUCTNAME }}
              </option>
            </select>
          </edit-item>

          <label-item title="车辆登记证车主" v-model="formdata.proCarOwner"></label-item>

          <label-item title ="还款频率" v-model="formdata.finRefundFreq"></label-item>

          <edit-item title="开票经销商">
            <md-input v-model="formdata.finOfferDealer"></md-input>
          </edit-item>

          <edit-item title="来源名称">
            <select v-model="formdata.finSourceName">
              <option v-for="option in g_mlist('326')" v-bind:value="option.itemvalue" :key="option.itemvalue">
                {{ option.itemcontent }}
              </option>
            </select>

          </edit-item>

          <edit-item title="销售顾问姓名*">
            <md-input v-model="formdata.finSalConsultabtName"></md-input>
          </edit-item>

          <edit-item title="销售顾问手机*">
            <md-input v-model="formdata.finSalConsultabtMobile" pattern="[0-9]{1,3}" v-on:invalid,input="custValid($event,'手机格式不正确')"></md-input>
          </edit-item>

          <edit-item title="车架号">
            <md-input v-model="formdata.finCarChassisNo" pattern="[0-9]" v-on:invalid,input="custValid($event,'车架号格式不正确')"></md-input>
          </edit-item>

          <edit-item title="车辆品牌*" edittype="S" :mergelen="2">
            <select v-model="formdata.finCarBrandId">
              <option v-for="option in g_mlist('29')" v-bind:value="option.itemvalue" :key="option.itemvalue">
                {{ option.itemcontent }}
              </option>
            </select>
          </edit-item>
          <edit-item title="车辆车系*" edittype="S" :mergelen="2">
            <select v-model="formdata.finCarSeriesId">
              <option v-for="option in g_mlist('29')" v-bind:value="option.itemvalue" :key="option.itemvalue">
                {{ option.itemcontent }}
              </option>
            </select>
          </edit-item>
          <edit-item title="车型*" edittype="S">
            <select v-model="formdata.finCarModelId">
              <option v-for="option in g_mlist('29')" v-bind:value="option.itemvalue" :key="option.itemvalue">
                {{ option.itemcontent }}
              </option>
            </select>
          </edit-item>

          <edit-item title="车辆颜色*">
            <md-input v-model="formdata.finCarColor"></md-input>
          </edit-item>

          <edit-item title="直销供货方名称">
            <md-input v-model="formdata.finDsName"></md-input>
          </edit-item>

          <edit-item title="直销供货方开户行">
            <md-input v-model="formdata.finDsBank"></md-input>
          </edit-item>

          <edit-item title="直销供货方账号">
            <md-input v-model="formdata.finDsAccount"></md-input>
          </edit-item>

          <label-item title ="是否二手车" v-model="formdata.finSecondhandFlg"></label-item>

          <edit-item title="卖方姓名">
            <md-input v-model="formdata.finSellerName"></md-input>
          </edit-item>

          <edit-item title="卖方证件号码">
            <md-input v-model="formdata.finSellerPaperNo"></md-input>
          </edit-item>

          <edit-item title="车辆出厂日期">
            <md-input v-model="formdata.finRegisterDate"></md-input>
          </edit-item>

          <edit-item title="二手车里程数">
            <md-input v-model="formdata.finCarMileage"></md-input>
          </edit-item>

          <edit-item title="过户次数">
            <md-input v-model="formdata.finTransferNumber"></md-input>
          </edit-item>

          <edit-item title="车辆发票金额（元）*">
            <md-input v-model="formdata.finCarInvoicePrice"></md-input>
          </edit-item>

          <edit-item title="首付金额（元）*">
            <md-input v-model="formdata.finDownPayment"></md-input>
          </edit-item>

          <label-item title ="首付比例" v-model="formdata.finDownPaymentRate"></label-item>
          <label-item title ="押金比例" v-model="formdata.finDepositRate"></label-item>
          <label-item title ="押金金额（元）" v-model="formdata.finDepositAmount"></label-item>
          <label-item title ="尾款（元）" v-model="formdata.finRemainAmount"></label-item>
          <label-item title ="尾款比例" v-model="formdata.finRemainRate"></label-item>

          <edit-item title="贷款期限*" edittype="S">
            <select v-model="formdata.finLeasehold">
              <option v-for="option in g_mlist('28')" v-bind:value="option.itemvalue" :key="option.itemvalue">
                {{ option.itemcontent }}
              </option>
            </select>
          </edit-item>

          <label-item title ="手续费（元）" v-model="formdata.finFeeAmount"></label-item>

          <edit-item title="抵押办理城市*" edittype="S">
            <select v-model="formdata.mortgageCityId">
              <option v-for="option in g_mlist('29')" v-bind:value="option.itemvalue" :key="option.itemvalue">
                {{ option.itemcontent }}
              </option>
            </select>
          </edit-item>

          <label-item title ="抵押办理方" v-model="formdata.mortgageOrg"></label-item>

          <edit-item title="购置税（元）">
            <md-input v-model="formdata.finCarTax"></md-input>
          </edit-item>

          <edit-item title="保险费用（元）">
            <md-input v-model="formdata.finInsuranceCost"></md-input>
          </edit-item>

          <edit-item title="上牌及其他杂费（元）">
            <md-input v-model="formdata.finLicenseCost"></md-input>
          </edit-item>

          <edit-item title="牌照费（元）">
            <md-input v-model="formdata.finLicenseFee"></md-input>
          </edit-item>

          <edit-item title="LBS管理费（元）">
            <md-input v-model="formdata.finOtherCost"></md-input>
          </edit-item>

          <edit-item title="装潢费(仅限GPS)（元）">
            <md-input v-model="formdata.finUpholsterCost"></md-input>
          </edit-item>

          <edit-item title="平台费用（元）">
            <md-input v-model="formdata.finUpkeepCost"></md-input>
          </edit-item>

          <edit-item title="金融服务费（元）">
            <md-input v-model="formdata.finFinanceFee"></md-input>
          </edit-item>

          <edit-item title="提车减免费（元）">
            <md-input v-model="formdata.finCarBreaksFee"></md-input>
          </edit-item>

          <edit-item title="垫付保证金比例*" edittype="S">
            <select v-model="formdata.finPrePaymentRate">
              <option v-for="option in g_mlist('77')" v-bind:value="option.itemvalue" :key="option.itemvalue">
                {{ option.itemcontent }}
              </option>
            </select>
          </edit-item>

          <edit-item title="垫付保证金金额（元）">
            <md-input v-model="formdata.finPrePaymentAmount"></md-input>
          </edit-item>

          <edit-item title="是否配置GPS" edittype="R">
            <input type="radio" id="yes" value="1" v-model="formdata.finHasGpsFlg">是
            <input type="radio" id="no" value="0" v-model="formdata.finHasGpsFlg">否
          </edit-item>

          <edit-item title="GPS打包融资" edittype="S">
            <select v-model="formdata.finPackageFlg">
              <option v-for="option in g_mlist('20')" v-bind:value="option.itemvalue" :key="option.itemvalue">
                {{ option.itemcontent }}
              </option>
            </select>
          </edit-item>

          <edit-item title="GPS售价">
            <md-input v-model="formdata.finGpsPrice"></md-input>
          </edit-item>

          <label-item title="项目总额（元）" v-model="formdata.proCarOwner"></label-item>
          <label-item title="融资总额（元）" v-model="formdata.proCarOwner"></label-item>
          <label-item title="风险敞口（元）" v-model="formdata.proCarOwner"></label-item>
          <label-item title="风险敞口车价比" v-model="formdata.proCarOwner"></label-item>
          <label-item title="月供（元）" v-model="formdata.proCarOwner"></label-item>

          <edit-item title="创建备注*" :mergelen="5">
            <textarea v-model="formdata.appCreatComment" style="width:100%;" rows="4"></textarea>
          </edit-item>

        </div>
      </md-card-content>
    </md-card>
</template>
<script>
import LabelItem from './Unit/LabelItem.vue'
import EditItem from './Unit/EditItem.vue'
import validator from '@/utils/validator'

export default {
  components: {
    'label-item': LabelItem,
    'edit-item': EditItem
  },
  data () {
    return {
      // 金融产品list
      productlist: []
    }
  },
  props: {
    dataBackgroundColor: {
      type: String,
      default: ''
    },
    fininstid: '',
    formdata: {}
  },
  watch: {
    'formdata.finCarModelId': function (val) {
      console.log('车型' + val)
    }
  },

  mounted: function () {
    // 取得产品列表
    window.common.getProductList(this.fininstid).then(data => {
      console.log('this is a call:' + this.fininstid)
      var lst = data.productlist
      this.productlist = lst
      if (lst.length > 0) {
        this.formdata.finProductId = lst[0].CARPRODUCTID
      }
    })
  },
  methods: {
    custValid: function (ele, msg) {
      return validator.custValid(ele, msg)
    }
  }
}

</script>
<style>

</style>
